/**
 * @param {string} a
 * @param {string} b
 * @return {string}
 */
 var addBinary = function(a, b) {
    let array_a = a.split('');
    let array_b = b.split('');
    let len = array_a.length>=array_b.length?array_a.length:array_b.length;
    let carry = 0, array_c = [], i = 1, c = [];
    let a1 = parseInt('0',2);
    let b1 = parseInt('0',2);
    for(i=1;i<=len;i++){
        a1 = parseInt(array_a[array_a.length-i],2)||parseInt('0',2);
        b1 = parseInt(array_b[array_b.length-i],2)||parseInt('0',2);
        c = (a1+b1+parseInt(carry,2)).toString(2).split('');
        carry = c.length>1?1:0;
        array_c.push(c[carry]);
    }
    if(carry){
        array_c.push(carry.toString());
    }
    return array_c.reverse().join('');
};